import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

class Demo3_1_3 {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 1, 1, 2, 2);
        System.out.println("--------------- distinct 前");
        System.out.println(list);
        System.out.println("--------------- distinct 后");
        List<Integer> distinctedList = list.stream().distinct().collect(Collectors.toList());
        System.out.println(distinctedList);
    }
}